package main

import (
	"fmt"
	"math/rand"
	"time"

	qsort "zhiq/algorithm/quicksort/lib"
	selectSort "zhiq/algorithm/selectsort/lib"
)

func main() {
	// s := []int{10, 20, 30, 50, 1, 2, 8, 7, 6, 5, 232, 111, 22}
	s := getRandNum(10000)
	var s1 = make([]int, len(s))
	var s2 = make([]int, len(s))
	copy(s1, s)
	copy(s2, s)
	t := time.Now()
	qsort.QuickSort(s, 0, len(s)-1)
	speed := time.Since(t)
	fmt.Println(speed)

	t = time.Now()
	selectSort.SelectSort(s1)
	speed = time.Since(t)
	fmt.Println(speed)

	t = time.Now()
	qsort.QuickSortV2(s2, 0, len(s2)-1)
	speed = time.Since(t)
	fmt.Println(speed)

	// fmt.Println(s)
	// fmt.Println(s1)
	// fmt.Println(s2)
}

func getRandNum(quantity uint) (res []int) {
	rand.Seed(time.Now().Unix())
	for quantity > 0 {
		res = append(res, rand.Int())
		quantity--
	}

	return
}
